package Tests;

import static org.junit.Assert.*;

import java.util.ArrayList;

import org.junit.Test;

import ParsingSys.Parser;

public class ParserTests {

	
	@Test
	public void matchPass(){
		ArrayList<String> matchAgainst = new ArrayList<String>();
		matchAgainst.add("D");
		matchAgainst.add("C");
		matchAgainst.add("B");
		matchAgainst.add("A");


		ArrayList<String> lines = new ArrayList<String>();
		lines.add("A:B,C");
		lines.add("B:D");
		lines.add("C:D");
		
		Parser p = new Parser(lines, matchAgainst);
		assertTrue(p.match());

	}
	
	
	@Test
	public void matchFailStart(){
		ArrayList<String> matchAgainst = new ArrayList<String>();
		matchAgainst.add("A");
		matchAgainst.add("D");
		matchAgainst.add("B");
		matchAgainst.add("C");

		ArrayList<String> lines = new ArrayList<String>();
		lines.add("A:B,C");
		lines.add("B:D");
		lines.add("C:D");
		
		Parser p = new Parser(lines, matchAgainst);
		assertFalse(p.match());

	}
	
	
	@Test
	public void matchFailMid(){
		ArrayList<String> matchAgainst = new ArrayList<String>();
		matchAgainst.add("D");
		matchAgainst.add("A");
		matchAgainst.add("B");
		matchAgainst.add("C");

		ArrayList<String> lines = new ArrayList<String>();
		lines.add("A:B,C");
		lines.add("B:D");
		lines.add("C:D");
		
		Parser p = new Parser(lines, matchAgainst);
		assertFalse(p.match());

	}
}
